/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.bio.jpa.entities;

import java.io.Serializable;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author Diego
 */
@Entity
@Table(name = "project_status", catalog = "biodb", schema = "")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "ProjectStatus.findAll", query = "SELECT p FROM ProjectStatus p"),
    @NamedQuery(name = "ProjectStatus.findByIdprjSts", query = "SELECT p FROM ProjectStatus p WHERE p.idprjSts = :idprjSts"),
    @NamedQuery(name = "ProjectStatus.findByDesc", query = "SELECT p FROM ProjectStatus p WHERE p.desc = :desc")})
public class ProjectStatus implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.SEQUENCE)
    @Basic(optional = false)
    @Column(name = "idprj_sts")
    private Integer idprjSts;
    @Basic(optional = false)
    @Size(min = 1, max = 60)
    @Column(name = "desc")
    private String desc;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "projectStatus")
    private List<Project> projectList;

    public ProjectStatus() {
    }

    public ProjectStatus(Integer idprjSts) {
        this.idprjSts = idprjSts;
    }

    public ProjectStatus(Integer idprjSts, String desc) {
        this.idprjSts = idprjSts;
        this.desc = desc;
    }

    public Integer getIdprjSts() {
        return idprjSts;
    }

    public void setIdprjSts(Integer idprjSts) {
        this.idprjSts = idprjSts;
    }

    public String getDesc() {
        return desc;
    }

    public void setDesc(String desc) {
        this.desc = desc;
    }

    @XmlTransient
    public List<Project> getProjectList() {
        return projectList;
    }

    public void setProjectList(List<Project> projectList) {
        this.projectList = projectList;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idprjSts != null ? idprjSts.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof ProjectStatus)) {
            return false;
        }
        ProjectStatus other = (ProjectStatus) object;
        if ((this.idprjSts == null && other.idprjSts != null) || (this.idprjSts != null && !this.idprjSts.equals(other.idprjSts))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "com.bio.jpa.entities.ProjectStatus[ idprjSts=" + idprjSts + " ]";
    }

}
